<template>
	<div>
		<div>
			<view>商家管理</view>
			<view >
			<view v-for="(item,index) in storelist" :key="item.storeId" @click="id(item.storeId)">
				序号:{{index}},商家编号:{{item.storeId}},商家:{{item.storeName}},名称:{{item.userName}},商家状态:{{item.storeState}}
			</view>
			</view>
		</div>
	</div>
	
</template>

<script>
	export default {
		data() {
			return {
				title: '商家管理',
				storelist:{},
				userId:'',
				userName:'',
				userRole:'',
				storeId:''
			}
		},
		onLoad() {
			this.handIntegralSelect()
		},
		methods: {
			handIntegralSelect(){
				const value = uni.getStorageSync('userId');
				console.log(value)
				this.userId=value
				const value1 = uni.getStorageSync('userRole');
				console.log(value1)
				this.userRole=value1
				const value2 = uni.getStorageSync('userName');
				console.log(value2)
				this.userName=value2
				uni.request({
				    url: `http://localhost:7000/shop/store/rolelist?userId=`+value+`&userRole=`+value1,
					data: this.storelist,
				    header: {
				        'custom-header': 'hello' //自定义请求头信息
				    },
					method:'POST',
				    success: (res) => {
				        console.log(res.data);
						this.storelist=res.data.data.records
					
						
				    },
				})	
			},
			id(storeId){
				uni.setStorage({
					key: 'storeId',
					data: storeId
				})
				uni.navigateTo({
					url:"../commodity/index?storeId="+storeId
					
				})
			},
			integral(){
				uni.navigateTo({
					url:"../integral/index"
				})
			},
			handUpdate(){
				uni.navigateTo({
					url:"../modification/index"
				})
			},
			artice(){
				uni.navigateTo({
					url:"../article/index"
				})
			}
		},
		mounted() {
			this.handIntegralSelect()
		}
	}
</script>

<style lang="scss">
	.merchant{
		.mrchant_item{
			display: flex;
			padding: 10rpx 20 rpx;
			border-bottom: 1px ;
			.info{
				font-size: 24rpx;
			}
		}
	}
</style>
